package de.klingbeil.hhc.core.internal.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import de.klingbeil.hhc.core.domain.Item;
import de.klingbeil.hhc.core.repository.ItemRepository;
import de.klingbeil.hhc.core.service.ItemService;
import de.klingbeil.hhc.core.util.Assert;

@Service
public class ItemServiceImpl implements ItemService {

	@Resource
	ItemRepository itemRepository;

	@Override
	public Item persist(Item item) {
		Assert.isNotNull(item, "item");
		return itemRepository.save(item);
	}

	public Item findById(Long id) {
		Assert.isNotNull(id, "id");
		return itemRepository.findOne(id);
	}

	public List<Item> findAll() {
		return itemRepository.findAll();
	}

}
